package org.example.fengzhaosurprisemeal.Fengzhao.Test;

import com.example.myapp.components.MyComponent;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

@RunWith(SpringRunner.class)
@SpringBootTest
public class ComponentScanIntegrationTest {

    @Autowired
    private MyComponent myComponent;

    @Test
    public void whenContextLoads_thenMyComponentShouldBeAutowired() {
        // 这个测试验证 MyComponent 是否被自动注入
        assertNotNull(myComponent);
        myComponent.performAction(); // 调用组件的方法以确保它能够正常工作
    }
}
